var KOC = require("koc.common.utils");

var Config = require("../../config");

var StateData = require("../statedata");
var DALFactory = require("../../lib/dal/dal-factory");
var CommonUtils = require("../../lib/common-utils");
var FileBuilder = require("../../lib/file-builder");
var Interface_QCloud = require("../../lib/interface-qcloud");
var Interface_Geetest = require("../../lib/interface-geetest");

module.exports = {
  Service: function (req, res) {
    switch (req.params.type) {
      //region Base
      case "base.logout":
        ajaxFactory.Base.Logout(req, res);
        return;
      case "base.user-photo.anchor-cover":
        ajaxFactory.Base.User_Photo.Anchor_Cover(req, res);
        return;
      case "base.user-photo.user-idcard":
        ajaxFactory.Base.User_Photo.User_IDCard(req, res);
        return;
      case "base.user-photo.anchor-avatar":
        ajaxFactory.Base.User_Photo.Anchor_Avatar(req, res);
        return;
      //endregion
      //region Business
      case "business.user-signin":
        ajaxFactory.Business.User_SignIn(req, res);
        return;
      case "business.user-signup":
        ajaxFactory.Business.User_SignUp(req, res);
        return;
      case "business.rediscommon-giftuserrankingweeklist":
        ajaxFactory.Business.RedisCommon_GiftUserRankingWeekList(req, res);
        return;
      case "business.user-attention":
        ajaxFactory.Business.User_Attention(req, res);
        return;
      case "business.user-mountsupdate":
        ajaxFactory.Business.User_MountsUpdate(req, res);
        return;
      case "business.user-mountspurchase":
        ajaxFactory.Business.User_MountsPurchase(req, res);
        return;
      case "business.user-vippurchase":
        ajaxFactory.Business.User_VIPPurchase(req, res);
        return;
      //endregion
      //region User
      //endregion
      //region Report
      case "report.family-month.list":
        ajaxFactory.Report.Family_Month.List(req, res);
        return;
      case "report.anchor-month.list":
        ajaxFactory.Report.Anchor_Month.List(req, res);
        return;
      case "report.anchor-family-month.list":
        ajaxFactory.Report.Anchor_Family_Month.List(req, res);
        return;
      //endregion
      //region RCommon
      case "rcommon.useranchorlisthot.get":
        ajaxFactory.RCommon.UserAnchorListHot.Get(req, res);
        return;
      case "rcommon.useranchorlistnew.get":
        ajaxFactory.RCommon.UserAnchorListNew.Get(req, res);
        return;
      //endregion
    }
    res.jsonp({flag: -9999, msg: "未知的请求"});
  }
};

var ajaxFactory = {
  Base: {
    //region Logout:退出登录
    Logout: function (req, res) {
      StateData.Clear(req, res);
      StateData.Cookie.Remember.Clear(res);
      res.jsonp({flag: 0, msg: "退出完成"});
    },
    //endregion
    //region User_Photo:用户图片上传
    User_Photo: {
      //region Anchor_Cover:艺人上传封面(个人中心)
      Anchor_Cover: function (req, res) {
        var _UserData = StateData.Value(req, res);
        if (!_UserData.IsLogin) {
          res.jsonp({flag: -1, msg: "请登录后进行此操作"});
          return;
        }
        if (!_UserData.IsAnchor) {
          res.jsonp({flag: 2, msg: "您不是艺人，请重新登录"});
          return;
        }
        if (!req.params.FileName) {
          res.jsonp({flag: 3, msg: "参数错误，请重新上传艺人封面"});
          return;
        }
        var _parm = {
          FileName: KOC.StringUtils.ToString(req.params.FileName),//艺人封面信息
          FileInfo: KOC.StringUtils.ToString(req.params.FileName).split("."),
          ImgInfo: {}
        };
        if (_parm.FileInfo.length !== 2) {
          res.jsonp({flag: 1, msg: "请上传艺人封面"});
          return;
        }
        KOC.Async.series([
          //艺人海报信息处理
          function (callback) {
            DALFactory.Business.User_AnchorCoverPut({
              User_ID: _UserData.User_ID,
              NickName: _UserData.NickName,
              ImageName: _parm.FileInfo[0],
              Type: 1,
              Create_IP: KOC.StringUtils.GetClientIP(req)
            }, function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              _parm.ImgInfo = retValue.returnObject;
              callback();
            });
          },
          //删除临时文件
          function (callback) {
            if (!_parm.ImgInfo.ImageExist && !_parm.ImgInfo.OldImage) {
              //艺人海报信息不存在
              callback();
              return;
            }
            FileBuilder.Common.TempFileRemove(_parm.ImgInfo.OldImage, function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              callback();
            });
          }
        ], function (retValue) {
          if (retValue) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          res.jsonp({flag: 0, msg: "封面申请成功"});
        });

      },
      //endregion
      //region Anchor_Avatar:用户上传头像(个人中心)
      Anchor_Avatar: function (req, res) {
        var _UserData = StateData.Value(req, res);
        if (!_UserData.IsLogin) {
          res.jsonp({flag: -1, msg: "请登录后进行此操作"});
          return;
        }
        if (!req.params.FileName) {
          res.jsonp({flag: 3, msg: "参数错误，请重新上传用户头像"});
          return;
        }
        var _parm = {
          FileName: KOC.StringUtils.ToString(req.params.FileName),//用户头像信息
          FileInfo: KOC.StringUtils.ToString(req.params.FileName).split("."),
          ImgInfo: {}
        };
        if (_parm.FileInfo.length !== 2) {
          res.jsonp({flag: 1, msg: "请上传用户上传头像"});
          return;
        }
        KOC.Async.series([
          //用户头像信息处理
          function (callback) {
            DALFactory.Business.User_AnchorCoverPut({
              User_ID: _UserData.User_ID,
              NickName: _UserData.NickName,
              ImageName: _parm.FileInfo[0],
              Type: 2,
              Create_IP: KOC.StringUtils.GetClientIP(req)
            }, function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              _parm.ImgInfo = retValue.returnObject;
              callback();
            });
          },
          //删除临时文件
          function (callback) {
            if (!_parm.ImgInfo.ImageExist && !_parm.ImgInfo.OldImage) {
              //用户头像信息不存在
              callback();
              return;
            }
            FileBuilder.Common.TempFileRemove(_parm.ImgInfo.OldImage, function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              callback();
            });
          }
        ], function (retValue) {
          if (retValue) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          res.jsonp({flag: 0, msg: "头像上传成功"});
        });

      },
      //endregion
      //region User_IDCard:用户上传身份证图片
      User_IDCard: function (req, res) {
        var _UserData = StateData.Value(req, res);
        //判断是否登录
        if (!_UserData.IsLogin) {
          res.jsonp({flag: -1, msg: "请登录后进行此操作"});
          return;
        }
        if (!req.params.FileName || !req.params.Front) {
          res.jsonp({flag: 2, msg: "参数错误，请重新上传身份证"});
          return;
        }
        var _parm = {
          FileName: KOC.StringUtils.ToString(req.params.FileName),
          Front: KOC.StringUtils.ToString(req.params.Front),
          FileInfo: KOC.StringUtils.ToString(req.params.FileName).split(".")
        };
        if (_parm.FileInfo.length !== 2) {
          res.jsonp({flag: 1, msg: "请上传身份证图片"});
          return;
        }
        KOC.Async.series([
          //查是否可以上传
          function (callback) {
            DALFactory.User.User_Info.Info(_UserData.User_ID, function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              if (retValue.returnObject && retValue.returnObject.IDCardStatus != 2 && retValue.returnObject.IDCardStatus != -1) {
                retValue.errorCodes = 2;
                retValue.message = "艺人信息错误不能上传身份证图片";
                callback(retValue);
                return;
              }
              callback();
            });
          },
          //上传身份证图片
          function (callback) {
            FileBuilder.User.IDCard.Build(_UserData.User_ID, _parm.Front, FileBuilder.Common.TempFilePath(_parm.FileInfo[0]), function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              callback();
            });
          },
          //刷新cdn图片缓存
          function (callback) {
            Interface_QCloud.RefreshUrl(FileBuilder.User.IDCard.UrlAll(_UserData.User_ID, "anchor-idcard-" + _parm.Front), function (retValue) {
              if (retValue.hasError) {
                callback(retValue);
                return;
              }
              callback();
            })
          }
        ], function (retValue) {
          if (retValue) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          res.jsonp({flag: 0, msg: "上传身份证完成"});
        });
      }
      //endregion
    },
    //endregion
  },
  Business: {
    //region User_SignIn:用户登录
    User_SignIn: function (req, res) {
      var _UserData = StateData.Value(req, res);
      if (_UserData.IsLogin) {
        res.jsonp({flag: -1, msg: "您已经登录"});
        return;
      }
      KOC.Async.series([
        //极验验证
        // function (callback) {
        //   Interface_Geetest.Validate({
        //     challenge: req.params.geetest_challenge,
        //     validate: req.params.geetest_validate,
        //     seccode: req.params.geetest_seccode
        //   }, function (retValue) {
        //     if (retValue.hasError) {
        //       callback(retValue);
        //       return;
        //     }
        //     callback();
        //   });
        // },
        //用户登录
        function (callback) {
          DALFactory.Business.User_Login({
            LoginName: req.params.LoginName,
            Password: req.params.Password,
            SignIn_Origin: 0,
            SignIn_Type: 2,
            Create_IP: KOC.StringUtils.GetClientIP(req)
          }, function (retValue) {
            if (retValue.hasError) {
              callback(retValue);
              return;
            }
            //写入session
            StateData.Set(req, res, retValue.returnObject);
            //自动登录
            if (req.params.Remember) {
              StateData.Cookie.Remember.Set(res, req.params.LoginName, req.params.Password);
            }
            callback();
          });
        }
      ], function (retValue) {
        if (retValue) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        res.jsonp({flag: 0, msg: "登录完成"});
      });
    },
    //endregion
    //region User_SignUp:用户注册
    User_SignUp: function (req, res) {
      var _UserData = StateData.Value(req, res);
      if (_UserData.IsLogin) {
        res.jsonp({flag: -1, msg: "您已经登录"});
        return;
      }
      var _parm = {
        Channel_ID: StateData.Cookie.ChannelID.Get(req),
        Inviter_ID: StateData.Cookie.InviterID.Get(req),
        Room_ID: req.params.Room_ID,
        SignUp_Url: req.params.SignUp_Url,
        Phone: req.params.Phone,
        PhoneCode: req.params.VerifyCode,
        Password: req.params.Password,
        Create_IP: KOC.StringUtils.GetClientIP(req)
      };
      if (!_parm.SignUp_Url && req.headers.origin) {
        _parm.SignUp_Url = "Origin:" + req.headers.origin;
      }
      if (!_parm.SignUp_Url && req.headers.referer) {
        _parm.SignUp_Url = "Referer:" + req.headers.referer;
      }
      if (!_parm.Phone || !(/^1\d{10}$/).test(_parm.Phone)) {
        res.jsonp({flag: 2, msg: "手机号码不正确"});
        return;
      }
      DALFactory.Business.User_SignIn({
        Channel_ID: _parm.Channel_ID,
        Inviter_ID: _parm.Inviter_ID,
        Room_ID: _parm.Room_ID,
        Phone: _parm.Phone,
        PhoneCode: _parm.PhoneCode,
        Password: _parm.Password,
        SignUp_Origin: 0,
        SignUp_Url: _parm.SignUp_Url,
        Create_IP: _parm.Create_IP
      }, function (retValue) {
        if (retValue.hasError) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        //写入session
        StateData.Set(req, res, retValue.returnObject);
        res.jsonp({flag: 0, msg: "注册成功"});
      });
    },
    //endregion
    //region User_Attention:关注(添加/取消)
    User_Attention: function (req, res) {
      var _UserData = StateData.Value(req, res);
      if (!_UserData.IsLogin) {
        res.jsonp({flag: -1, msg: "请登录后进行此操作"});
        return;
      }
      if (!req.params.User_ID_Attention) {
        res.jsonp({flag: 1, msg: "请求参数出错，请重新请求"});
        return;
      }
      DALFactory.Business.User_Attention({
        User_ID: _UserData.User_ID,
        User_ID_Attention: req.params.User_ID_Attention,
        Cancel: req.params.Type//取消关注为true,关注不传
      }, function (retValue) {
        if (retValue.hasError) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        res.jsonp({flag: 0});
      });
    },
    //endregion
    //region User_MountsUpdate:用户更换坐骑
    User_MountsUpdate: function (req, res) {
      var _UserData = StateData.Value(req, res);
      if (!_UserData.IsLogin) {
        res.jsonp({flag: -1, msg: "请登录后进行此操作"});
        return;
      }
      if (!req.params.Mounts_ID) {
        res.jsonp({flag: 1, msg: "请求参数出错，请重新请求"});
        return;
      }
      DALFactory.Business.User_MountsUpdate({
        User_ID: _UserData.User_ID,
        Mounts_ID: req.params.Mounts_ID,
        Create_IP: KOC.StringUtils.GetClientIP(req)
      }, function (retValue) {
        if (retValue.hasError) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        res.jsonp({flag: 0, msg: "坐骑切换完成"});
      });
    },
    //endregion
    //region User_MountsPurchase:座骑购买
    User_MountsPurchase: function (req, res) {
      var _UserData = StateData.Value(req, res);
      if (!_UserData.IsLogin) {
        res.jsonp({flag: -1, msg: "请登录后进行此操作"});
        return;
      }
      if (!req.params.Mounts_ID) {
        res.jsonp({flag: 1, msg: "请求参数出错，请重新请求"});
        return;
      }
      DALFactory.Business.User_MountsPurchase({
        User_ID: _UserData.User_ID,
        Mounts_ID: req.params.Mounts_ID,
        Num: KOC.StringUtils.ToInt(req.params.Num, 1),
        Create_IP: KOC.StringUtils.GetClientIP(req)
      }, function (retValue) {
        if (retValue.hasError) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        res.jsonp({flag: 0, msg: "座驾购买完成"});
      });
    },
    //endregion
    //region User_VIPPurchase:VIP购买
    User_VIPPurchase: function (req, res) {
      var _UserData = StateData.Value(req, res);
      if (!_UserData.IsLogin) {
        res.jsonp({flag: -1, msg: "请登录后进行此操作"});
        return;
      }
      if (!req.params.VIP_ID) {
        res.jsonp({flag: 1, msg: "请求参数出错，请重新请求"});
        return;
      }
      DALFactory.Business.User_VIPPurchase({
        User_ID: _UserData.User_ID,
        VIP_ID: req.params.VIP_ID,
        Create_IP: KOC.StringUtils.GetClientIP(req)
      }, function (retValue) {
        if (retValue.hasError) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        res.jsonp({flag: 0, msg: "VIP购买成功！"});
      });
    },
    //endregion
    //region RedisCommon_GiftUserRankingWeekList:礼物用户排行
    RedisCommon_GiftUserRankingWeekList: function (req, res) {
      DALFactory.Business.RedisCommon_GiftUserRankingWeekList({
        Gift_ID: req.params.Gift_ID, //WeekStar:所有周星礼物 其它:礼物ID(多个用,号分隔)
        Limit_G: req.params.Limit_G, //送出人-获取数量 <=0:不获取 >0:取得数量
        Limit_R: req.params.Limit_R //接收人-获取数量 <=0:不获取 >0:取得数量
      }, function (retValue) {
        if (retValue.hasError) {
          res.jsonp({flag: retValue.errorCode, msg: retValue.message});
          return;
        }
        res.jsonp({flag: 0, msg: "", data: retValue.returnObject});
      });
    }
    //endregion
  },
  User: {
    //region Page:分页
    Page: {}
    //endregion
  },
  Report: {
    //region Family_Info:公会月表
    Family_Month: {
      List: function (req, res) {
        var _UserData = StateData.Value(req, res);
        if (!_UserData.IsLogin) {
          res.jsonp({flag: -1, msg: '请登录后使用此功能'});
          return;
        }
        if (!_UserData.IsFamily) {
          res.jsonp({flag: -2, msg: '您不是公会长，请重新登录'});
          return;
        }
        DALFactory.Report.Family_Month.List({
          Family_ID: _UserData.Family.Family_ID,
          Limit: KOC.StringUtils.ToIntPositive(req.params.Limit),
          Report_Day_Start: req.params.Report_Day_Start,
          Report_Day_End: req.params.Report_Day_End
        }, function (retValue) {
          if (retValue.hasError) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
            KOC.Lodash.pick(ThisValue, [
              "Report_Day",
              "Family_ID",
              "Family_Name",
              "Anchor_Count",
              "Anchor_Count_Live",
              "Anchor_Count_TaskBeans",
              "Anchor_Count_TaskLiveDay",
              "Anchor_Count_TaskLiveDuration",
              "Anchor_Count_TaskAll",
              "Anchor_Salary",
              "Anchor_Salary_Base",
              "Anchor_Salary_BonusBeans",
              "Salary",
              "Salary_BonusBeans",
              "Salary_BonusBeans_Degree",
              "Coin",
              "Coin_Task",
              "Coin_Package_Task",
              "Beans_Anchor",
              "Beans_Anchor_Task",
              "Beans_Anchor_Package_Task",
              "Beans_Family",
              "Beans_Family_Task",
              "Beans_Family_Package_Task",
              "Live_Count",
              "Live_Duration",
              "Live_Duration_Efftive",
              "Live_Day",
              "Live_Day_Efftive",
              "Gift_Count",
              "Gift_Count_Task",
              "Gift_Count_Package_Task",
              "Gift_Num",
              "Gift_Num_Task",
              "Gift_Num_Package_Task",
              "Gift_Coin",
              "Gift_Coin_Task",
              "Gift_Coin_Package_Task",
              "Gift_Beans_Anchor",
              "Gift_Beans_Anchor_Task",
              "Gift_Beans_Anchor_Package_Task",
              "Gift_Beans_Family",
              "Gift_Beans_Family_Task",
              "Gift_Beans_Family_Package_Task"
            ]);
          });
          res.jsonp({flag: 0, msg: "", data: retValue.returnObject});
        })
      }
    },
    //endregion
    //region Anchor_Month:艺人月表
    Anchor_Month: {
      List: function (req, res) {
        var _UserData = StateData.Value(req, res);
        if (!_UserData.IsLogin) {
          res.jsonp({flag: -1, msg: '请登录后使用此功能'});
          return;
        }
        if (!_UserData.IsAnchor) {
          res.jsonp({flag: -2, msg: '您不是艺人，请重新登录'});
          return;
        }
        DALFactory.Report.Anchor_Month.List({
          User_ID: _UserData.User_ID,
          Family_ID: _UserData.Anchor.Family_ID,
          Report_Day_Start: req.params.Report_Day_Start,
          Report_Day_End: req.params.Report_Day_End,
          Limit: KOC.StringUtils.ToIntPositive(req.params.Limit),
          IsProtect: req.params.IsProtect,
          IsProtectDue: req.params.IsProtectDue,
          Order: req.params.Order
        }, function (retValue) {
          if (retValue.hasError) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
            KOC.Lodash.pick(ThisValue, [
              "Report_Day",
              "Family_ID",
              "Family_Name",
              "NickName",
              "RealName",
              "IsProtect",
              "IsProtectDue",
              "Score",
              "Task_Target_Salary",
              "Task_Target_Beans",
              "Task_Target_LiveDay",
              "Task_Target_LiveDuration",
              "Task_Rate_Beans",
              "Task_Rate_LiveDay",
              "Task_Rate_LiveDuration",
              "Salary",
              "Salary_Base",
              "Salary_BonusBeans",
              "Coin",
              "Coin_Task",
              "Coin_Package_Task",
              "Beans_Anchor",
              "Beans_Anchor_Task",
              "Beans_Anchor_Package_Task",
              "Beans_Family",
              "Beans_Family_Task",
              "Beans_Family_Package_Task",
              "Live_Count",
              "Live_Duration",
              "Live_Duration_Efftive",
              "Live_Day",
              "Live_Day_Efftive",
              "Gift_Count",
              "Gift_Count_Task",
              "Gift_Count_Package_Task",
              "Gift_Num",
              "Gift_Num_Task",
              "Gift_Num_Package_Task",
              "Gift_Coin",
              "Gift_Coin_Task",
              "Gift_Coin_Package_Task",
              "Gift_Beans_Anchor",
              "Gift_Beans_Anchor_Task",
              "Gift_Beans_Anchor_Package_Task",
              "Gift_Beans_Family",
              "Gift_Beans_Family_Task",
              "Gift_Beans_Family_Package_Task"
            ]);
          });
          res.jsonp({flag: 0, msg: '', data: retValue.returnObject});
        })
      }

    },
    //endregion
    //region Anchor_Family_Month:艺人公会月表
    Anchor_Family_Month: {
      //region List 某个公会的艺人列表
      List: function (req, res) {
        var _UserData = StateData.Value(req, res);
        if (!_UserData.IsLogin) {
          res.jsonp({flag: -1, msg: '请登录后使用此功能'});
          return;
        }
        if (!_UserData.IsFamily) {
          res.jsonp({flag: -2, msg: '您不是公会长，请重新登录'});
          return;
        }
        DALFactory.Report.Anchor_Family_Month.List({
          Family_ID: _UserData.Family.Family_ID,
          Limit: KOC.StringUtils.ToIntPositive(req.params.Limit),
          User_ID: KOC.StringUtils.ToIntPositive(req.params.User_ID),
          NickName: KOC.StringUtils.ToString(req.params.NickName),
          Report_Day_Start: KOC.Moment(new Date(req.params.Report_Day_Start)).format('YYYY-MM-01'),
          Report_Day_End: KOC.Moment(new Date(req.params.Report_Day_End)).format('YYYY-MM-01')
        }, function (retValue) {
          if (retValue.hasError) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
            KOC.Lodash.pick(ThisValue, [//从某个对象中选择部分属性组成新的对象
              "Report_Day",
              "Family_ID",
              "Family_Name",
              "NickName",
              "RealName",
              "IsProtect",
              "IsProtectDue",
              "Score",
              "Task_Target_Salary",
              "Task_Target_Beans",
              "Task_Target_LiveDay",
              "Task_Target_LiveDuration",
              "Task_Rate_Beans",
              "Task_Rate_LiveDay",
              "Task_Rate_LiveDuration",
              "Salary",
              "Salary_Base",
              "Salary_BonusBeans",
              "Coin",
              "Coin_Task",
              "Coin_Package_Task",
              "Beans_Anchor",
              "Beans_Anchor_Task",
              "Beans_Anchor_Package_Task",
              "Beans_Family",
              "Beans_Family_Task",
              "Beans_Family_Package_Task",
              "Live_Count",
              "Live_Duration",
              "Live_Duration_Efftive",
              "Live_Day",
              "Live_Day_Efftive",
              "Gift_Count",
              "Gift_Count_Task",
              "Gift_Count_Package_Task",
              "Gift_Num",
              "Gift_Num_Task",
              "Gift_Num_Package_Task",
              "Gift_Coin",
              "Gift_Coin_Task",
              "Gift_Coin_Package_Task",
              "Gift_Beans_Anchor",
              "Gift_Beans_Anchor_Task",
              "Gift_Beans_Anchor_Package_Task",
              "Gift_Beans_Family",
              "Gift_Beans_Family_Task",
              "Gift_Beans_Family_Package_Task"
            ]);
          });
          res.jsonp({flag: 0, msg: '', data: retValue.returnObject});
        })
      }
      //endregion
    }
    //endregion
  },
  RCommon: {
    //region UserAnchorListHot:艺人热度列表(热度)
    UserAnchorListHot: {
      Get: function (req, res) {
        DALFactory.RedisCommon.UserAnchorListHot.Get(req.params.Start, req.params.Length, function (retValue) {
          if (retValue.hasError) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          res.jsonp({flag: 0, msg: "", data: retValue.returnObject});
        });
      }
    },
    //endregion
    //region UserAnchorListNew:艺人新秀列表(热度)
    UserAnchorListNew: {
      Get: function (req, res) {
        DALFactory.RedisCommon.UserAnchorListNew.Get(req.params.Start, req.params.Length, function (retValue) {
          if (retValue.hasError) {
            res.jsonp({flag: retValue.errorCode, msg: retValue.message});
            return;
          }
          res.jsonp({flag: 0, msg: "", data: retValue.returnObject});
        });
      }
    }
    //endregion
  }
};